package com.lfy.yunpicture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lfy.yunpicture.api.aliyun.model.CreateOutPaintingTaskResponse;
import com.lfy.yunpicture.api.aliyun.model.GetOutPaintingTaskResponse;
import com.lfy.yunpicture.model.dto.ai.PictureAiRequest;
import com.lfy.yunpicture.model.dto.file.*;
import com.lfy.yunpicture.model.entity.Picture;
import com.lfy.yunpicture.model.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 图片服务
 *
*/
public interface PictureService extends IService<Picture> {

    /**
     * 校验数据
     *
     * @param picture
     * @param add 对创建的数据进行校验
     */
    void validPicture(Picture picture, boolean add);

    /**
     * 获取查询条件
     *
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);
    
    /**
     * 获取图片封装
     *
     * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 分页获取图片封装
     *
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    /**
     * 文件上传
     * @param multipartFile
     * @param uploadPictureRequest
     * @param request
     * @return
     */
    PictureVO uploadFile(MultipartFile multipartFile,
                         UploadPictureRequest uploadPictureRequest, HttpServletRequest request);

    /**
     * Url上传
     * @param uploadPictureRequest
     * @param request
     * @return
     */
   PictureVO uploadFileUrl(UploadPictureRequest uploadPictureRequest, HttpServletRequest request);
    /**
     * 批量上传图片
     * @param pictureBatchUploadRequest
     * @param request
     * @return
     */
    Integer pictureBatchUpload(PictureBatchUploadRequest pictureBatchUploadRequest,HttpServletRequest request);

    /**
     * 校验空间是否存在
     * @param spaceId
     */
    void validSpaceId(Long spaceId);
    /**
     * 删除文件
     * @param id
     * @param request
     */
    void deletePicture(Long id , HttpServletRequest request);
    /**
     * 批量删除文件
     * @param ids
     */
    void deletePictureBatch(List<Long> ids);

    /**
     * 编辑图片
     * @param pictureEditRequest
     * @param request
     */
    void editPicture(PictureEditRequest pictureEditRequest, HttpServletRequest request);
    /**
     * Ai扩图
     */
    CreateOutPaintingTaskResponse.Output aiExpansion(PictureAiRequest aiRequest);

    GetOutPaintingTaskResponse getOutPaintingTask(String taskId);

    long addPicture(PictureAddRequest pictureAddRequest, HttpServletRequest request);
}
